﻿using System;
using System.Linq.Expressions;
using System.Text;
using System.Web.Mvc;

namespace BoneSystem.Extensions.Components
{

    public static partial class BoneSystemExtensions
    {
        const string FormatDate = "dd/MM/yyyy";
        const string FormatDateTime = "dd/MM/yyyy HH:MM";
        const string FormatHour = "HH:MM";

        public static MvcHtmlString FormatedLabelFor<T, TProperty>(this HtmlHelper<T> htmlHelper, Expression<Func<T, TProperty>> expression)
        {
            // var name = ControlExtensions.GetExpressionText(expression);
            var metadata = ModelMetadata.FromLambdaExpression(expression, htmlHelper.ViewData);
            StringBuilder value = null;
            
            return new MvcHtmlString("");
        }

        public static MvcHtmlString FormatedLabelFor<T, TProperty>(this HtmlHelper<T> htmlHelper,
            Expression<Func<T, TProperty>> expression, string format)
        {
            var metadata = ModelMetadata.FromLambdaExpression(expression, htmlHelper.ViewData);
            return new MvcHtmlString(((DateTime)metadata.Model).ToString(FormatDate));
        }

    }
}